import {createBrowserRouter, createHashRouter} from "react-router-dom";
import { Navigate } from "react-router-dom";
//使用页面懒加载
//提高应用程序性能
// const App=React.lazy(()=>import("../App"));
// const HomeIndex=React.lazy(()=>import("../views/home/Index"));
// const About=React.lazy(()=>import("../views/about/Index"));
// const Mine=React.lazy(()=>import("../views/mine/Index"));
// const Login=React.lazy(()=>import("../views/login/Login"));
// const Register=React.lazy(()=>import("../views/Register"));
// const NotFound=React.lazy(()=>import("../views/NotFound"));
// const Home=React.lazy(()=>import("../views/home/childrenPages/home/Home"));
// const Sing=React.lazy(()=>import("../views/home/childrenPages/sing/Sing"));
// const NewSong=React.lazy(()=>import("../views/home/childrenPages/newSong/NewSong"));
// const RankingList=React.lazy(()=>import("../views/home/childrenPages/rankingList/RankingList"));
import App from "../App";
import HomeIndex from "../views/home/Index";
import About from "../views/about/Index";
import Mine from "../views/mine/Index";
import Login from "../views/login/Login";
import Register from "../views/register/Register";
import NotFound from "../views/NotFound";
import Home from "../views/home/childrenPages/home/Home";
import Sing from "../views/home/childrenPages/sing/Sing";
import NewSong from "../views/home/childrenPages/newSong/NewSong";
import RankingList from "../views/home/childrenPages/rankingList/RankingList";
import MusicPlayer from "../views/musicPlayer/MusicPlayer";
import ILikeIt from "../views/mine/childrenPages/iLikeIt/ILikeIt";
import FollowWithInterest from "../views/mine/childrenPages/followWithInterest/FollowWithInterest";
import Fans from "../views/mine/childrenPages/fans/Fans";
import Album from "../views/mine/childrenPages/album/Album";
import SongSheet from "../views/mine/childrenPages/songSheet/SongSheet";
import CreatorCenter from "../views/creatorCenter/Index";
import CompositePages from "../views/compositePages/Index";
import CreateMusic from "../views/creatorCenter/childrenPages/createMusic/Index"
import CreateMusicCollect from "../views/creatorCenter/childrenPages/createMusicCollect/Index"
import CreateMusicList from "../views/creatorCenter/childrenPages/createMusicList/Index"
const router=createHashRouter([
  {
    path:"/",
    element:<App/>,
    children:[
      {
        path:"/home",
        element:<HomeIndex/>,
        children:[
          {
            path: "",
            element: <Home/>
          },
          {
            path: "/home/sing",
            element: <Sing/>
          },
          {
            path: "/home/newsong",
            element: <NewSong/>
          },
          {
            path: "/home/rankinglist",
            element: <RankingList/>
          },
          //复合页面
          {
            path:"/home/compositepages",
            element:<CompositePages/>
          },
        ]
      },
      {
        path:"/creatorcenter",
        element:<CreatorCenter/>,
        children:[
          {
            path: "/creatorcenter",
            element: <CreateMusicList/>
          },
          {
            path: "/creatorcenter/createmusic",
            element: <CreateMusic/>
          },
          {
            path: "/creatorcenter/createmusiccollect",
            element: <CreateMusicCollect/>
          }
        ]
      },
      {
        path:"/about",
        element:<About/>
      },
      {
        path:"/mine",
        element:<Mine/>,
        children:[
          {
            path: "",
            element: <ILikeIt/>
          },
          {
            path: "/mine/follow",
            element: <FollowWithInterest/>
          },
          {
            path: "/mine/fans",
            element: <Fans/>
          },
          {
            path: "/mine/songsheet",
            element: <SongSheet/>
          },
          {
            path: "/mine/album",
            element: <Album/>
          },
        ]
      },
    ]
  },
  {
    path:"/login",
    element:<Login/>
  },
  {
    path:"/register",
    element:<Register/>
  },
  {
    path:"/musicplayer",
    element:<MusicPlayer/>
  },
  {
    path:"/*",
    element:<NotFound/>,
  }
]);

export default router;
